// import react from 'react'
import { Navigate, useRoutes } from 'react-router-dom';
import Home from '../pages/index'
import Login from '../pages/login'
import NoPage from '../pages/noPage'

import Main1 from '../components/home/Main/Main1'
import Main2 from '../components/home/Main/Main2'
import Main3 from '../components/home/Main/Main3'
import Main4 from '../components/home/Main/Main4'
import Main5 from '../components/home/Main/Main5'
import Main6 from '../components/home/Main/Main6'
import Main7 from '../components/home/Main/Main7'

// 采购
import PurchasingManagement from '../pages/Purchase/PurchasingManagement/PurchasingManagement'
import AddOrder from '../pages/Purchase/AddOrder/AddOrder'

// 销售
import DDLB from '../pages/Sale/DDLB'
import TJDD from '../pages/Sale/TJDD'
import DDXQ from '../pages/Sale/DDXQ'

// 资金
import OrderList from '../pages/Capital/OrderList/OrderList'
import ReturnList from '../pages/Capital/ReturnList'
import OrderPreview from '../pages/Purchase/OrderPreview/OrderPreview'

// 系统
// 基本资料
import Zwgl from '../components/system/basicInfor/ZWGL'
import PermSettings from '../components/system/basicInfor/ZWGL/PermSettings'
// 客户管理
import CustomerInformation from '../components/CustomerInformation'
import Customertype from '../components/Customertype'
import Supply from '../components/Supply.jsx'
import Addacustomer from '../components/Addacustomer.jsx'
import AddSuppliers from '../components/AddSuppliers.jsx'


// ljl
import Rootset from "../pages/Rootset/Rootset";
import CommodityManage from "../pages/Rootset/CommodityManage/CommodityManage";
import CMgrand from "../pages/Rootset/CommodityManage/CMgrand/CMgrand";
import CMclassfication from "../pages/Rootset/CommodityManage/CMclassfication/CMclassfication";
import CMsaleitems from "../pages/Rootset/CommodityManage/CMsaleitems/CMsaleitems";

import Inventory from "../pages/Inventory/Inventory";
import Outstorage from "../pages/Inventory/Outstorage/Outstorage";
import Instorage from "../pages/Inventory/Instorage/Instorage";
import AddInstorage from "../pages/Inventory/Instorage/AddInstorage/AddInstorage";
import ManageInstorage from "../pages/Inventory/Instorage/ManageInstorage/ManageInstorage";
import Testfoantd from "../pages/Testfoantd/Testfoantd";
//end


// zry
import WaysManager from "../pages/Behavior/WaysManager";
import AddWays from "../pages/Behavior/AddWays";
import VistiedSearch from "../pages/Behavior/VistiedSearch";
import VisitStats from "../pages/Behavior/VisitStats";
import UploadInfo from "../pages/Behavior/UploadInfo";
import ProductsSellDynamic from "../pages/Behavior/ProductsSellDynamic";
import StaffSellDynamic from "../pages/Behavior/StaffSellDynamic";
import StoreSellDynamic from "../pages/Behavior/StoreSellDynamic";
//end


export default function PrivateRoutes() {
    return (
        useRoutes([
            {
                path: '/',
                element: <Navigate to={'/login'} />
            }, {
                path: '/login',
                element: <Login />
            }, {
                path: '/home',
                element: <Home />,
                children: [
                    {
                        // 采购
                        path: '1', element: <Main1 />,
                        children: [
                            { path: "", element: <PurchasingManagement /> },
                            { path: "cggl", element: <PurchasingManagement /> },
                            { path: "cgsq", element: <AddOrder /> },
                            { path: "cgyl", element: <OrderPreview /> },
                        ]
                    },
                    {
                        // 销售
                        path: '2',
                        element: <Main2 />,
                        children: [
                            { path: "", element: <DDLB /> },
                            { path: "ddlb", element: <DDLB /> },
                            { path: "tjdd", element: <TJDD /> },
                        ]
                    },
                    {
                        // 库存
                        path: '3',
                        element: <Main3 />,
                        children: [
                            { path: "", element: <ManageInstorage /> },
                            { path: "ckgl", element: <NoPage /> },
                            { path: "tjckd", element: <NoPage /> },
                            { path: "rkgl", element: <ManageInstorage /> },
                            { path: "tjrkd", element: <AddInstorage /> },
                        ]
                    },
                    {
                        // 资金
                        path: '4',
                        element: <Main4 />,
                        children: [
                            { path: "", element: <OrderList /> },
                            { path: "ddlb", element: <OrderList /> },
                            { path: "qrsh", element: <NoPage /> },
                            { path: "dhtx", element: <NoPage /> },
                            { path: "ddsz", element: <NoPage /> },
                            { path: "thsqcl", element: <ReturnList /> },
                            { path: "tksqcl", element: <NoPage /> },
                            { path: "thyysz", element: <NoPage /> },
                            { path: "kddmb", element: <NoPage /> },
                            { path: "zdydyx", element: <NoPage /> },
                            { path: "fhdxxgl", element: <NoPage /> },
                        ]
                    },
                    {
                        // 行为
                        path: '5',
                        element: <Main5 />,
                        children: [
                            { path: "", element: <WaysManager /> },
                            { path: "lxgl", element: <WaysManager /> },
                            { path: "tjlx", element: <AddWays /> },
                            { path: "bfjgcx", element: <VistiedSearch /> },
                            { path: "bftj", element: <VisitStats /> },
                            { path: "scxxgl", element: <NoPage /> },
                            { path: "ryxxdt", element: <StaffSellDynamic /> },
                            { path: "spxxdt", element: <ProductsSellDynamic /> },
                            { path: "mdxxdt", element: <StoreSellDynamic /> },
                        ]
                    },
                    {
                        // 报表
                        path: '6',
                        element: <Main6 />,
                        children: [
                            { path: "", element: <NoPage /> },
                            { path: "mxhdlb", element: <NoPage /> },
                            { path: "sjdlb", element: <NoPage /> },
                            { path: "mstxtz", element: <NoPage /> },
                            { path: "yhqhl", element: <NoPage /> },
                            { path: "tjyhq", element: <NoPage /> },
                            { path: "hdlb", element: <NoPage /> },
                            { path: "tjhd", element: <NoPage /> },
                            { path: "ppzzs", element: <NoPage /> },
                            { path: "xxhw", element: <NoPage /> },
                            { path: "rqtj", element: <NoPage /> },
                            { path: "ztjx", element: <NoPage /> },
                        ]
                    },
                    {
                        // 系统
                        path: '7',
                        element: <Main7 />,
                        children: [
                            { path: "", element: <Zwgl /> },
                            { path: "gsxx", element: <NoPage /> },
                            { path: "bmgl", element: <NoPage /> },

                            { path: "zwgl", element: <Zwgl /> },
                            { path: 'permSettings', element: <PermSettings /> },

                            { path: "yggl", element: <NoPage /> },
                            { path: "ckgl", element: <NoPage /> },
                            { path: "jldw", element: <NoPage /> },
                            { path: "czrz", element: <NoPage /> },
                            {
                                path: "khxx", element: <CustomerInformation />,
                            },
                            { path: "tjkh", element: <Addacustomer /> },

                            { path: "khlx", element: <Customertype /> },
                            { path: "khqy", element: <NoPage /> },
                            { path: "ghcs", element: <Supply /> },
                            { path: "AddSuppliers", element: <AddSuppliers /> },


                            { path: "ppgl", element: <CMgrand /> },
                            { path: "spfl", element: <CMclassfication /> },
                            { path: "spxxwh", element: <CMsaleitems /> },
                            { path: "spzd", element: <NoPage /> },
                            { path: "jgtxsz", element: <NoPage /> },
                        ]
                    },
                ]
            }
        ])
    )
}